package com.ruoyi.rocky.service.impl;

import com.ruoyi.common.core.domain.R;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.rocky.mapper.PcFeedbackMapper;
import com.ruoyi.rocky.domain.PcFeedback;
import com.ruoyi.rocky.service.PcFeedbackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PcFeedbackServiceImpl implements PcFeedbackService {

    @Autowired
    private PcFeedbackMapper pcFeedbackMapper;

    /**
     * 根据反馈id查询反馈详情
     * @param feedbackId 反馈管理主键
     * @return
     */
    @Override
    public PcFeedback selectPcFeedbackByFeedbackId(Long feedbackId) {
        return pcFeedbackMapper.selectPcFeedbackByFeedbackId(feedbackId);
    }

    /**
     * 查询反馈列表
     * @param pcFeedback 反馈管理
     * @return
     */
    @Override
    public List<PcFeedback> selectPcFeedbackList(PcFeedback pcFeedback) {
        return pcFeedbackMapper.selectPcFeedbackList(pcFeedback);
    }

    /**
     * 新增反馈
     * @param pcFeedback 反馈管理
     * @return
     */
    @Override
    public R insertPcFeedback(PcFeedback pcFeedback) {
        pcFeedback.setCreateTime(DateUtils.getNowDate());
        return pcFeedbackMapper.insertPcFeedback(pcFeedback)>0?R.ok("新增成功"):R.fail("操作失败");
    }

//    /**
//     * 修改反馈
//     * @param pcFeedback 反馈管理
//     * @return
//     */
//    @Override
//    public R updatePcFeedback(PcFeedback pcFeedback) {
//        return null;
//    }

    /**
     * 批量删除反馈
     * @param feedbackIds 需要删除的反馈管理主键集合
     * @return
     */
    @Override
    public R deletePcFeedbackByFeedbackIds(Long[] feedbackIds) {
        return pcFeedbackMapper.deletePcFeedbackByFeedbackIds(feedbackIds)>0?R.ok("删除成功"):R.fail("删除失败");
    }

    /**
     * 删除反馈
     * @param feedbackId 反馈管理主键
     * @return
     */
    @Override
    public R deletePcFeedbackByFeedbackId(Long feedbackId) {
        return pcFeedbackMapper.deletePcFeedbackByFeedbackId(feedbackId)>0?R.ok("删除成功"):R.fail("删除失败");
    }
}
